﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QuickGraph;
using System.Xml.Serialization;
using System.Runtime.Serialization;

namespace EpidemicSimulator
{
    public class DiseaseModelEdge: Edge<DiseaseModelNode>
    {
        public DiseaseModelEdge(DiseaseModelNode node1, DiseaseModelNode node2)
            : base(node1, node2)
        {
            
        }

        [XmlAttribute("Condition")]
        public int condition { get; set; } //= 5; //podawane przez uzytkownika

        [XmlAttribute("probability")]
        public double transitionProbability { get; set; }

        [XmlAttribute("minTime")]
        public int minTransitionTime { get; set; }

        [XmlAttribute("maxTime")]
        public int maxTransitionTime { get; set; }

        public static string edgeIdentity<TVertex, TEdge>(TEdge edge) where TVertex: DiseaseModelNode where TEdge: DiseaseModelEdge
        {
            return edge.Source.stateName + "-" + edge.Target.stateName;
        }
    }

    [DataContract]
    public class SimpleDiseaseModelEdge
    {
        [DataMember]
        public double probability { get; set; }

        [DataMember]
        public int minTime { get; set; }

        [DataMember]
        public int maxTime { get; set; }

        private int m_source;
        
        private int m_target;

        private int condition;


        public SimpleDiseaseModelEdge()
        { 
            
        }

        public SimpleDiseaseModelEdge(SilverLightDiseaseModelNode source, SilverLightDiseaseModelNode target)
        {
            m_source = source.Id;
            m_target = target.Id;
        }


        [DataMember]
        public int Source
        {
            get { return m_source; }
            set { m_source = value; }
        }

        [DataMember]
        public int Target
        {
            get { return m_target; }
            set { m_target = value; }
        }

        [DataMember]
        public int Condition
        {
            get { return condition; }
            set { condition = value; }
        }
    }
}
